package com.heima.msg.listener;

import com.alibaba.fastjson.JSON;
import com.heima.msg.pojo.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class MsgListener {

    @KafkaListener(topics = "topic-01")
    public void onMsg(String msg){
        System.out.println(msg);
        User user = JSON.parseObject(msg, User.class);
        System.out.println(user);


    }
}
